package edu.ynu.se.xiecheng.achitectureclass.controller;

import edu.ynu.se.xiecheng.achitectureclass.common.controller.LogicController;
import edu.ynu.se.xiecheng.achitectureclass.dao.BusinessDao;
import edu.ynu.se.xiecheng.achitectureclass.entity.Business;
import edu.ynu.se.xiecheng.achitectureclass.entity.Item;
import edu.ynu.se.xiecheng.achitectureclass.entity.Shop;
import edu.ynu.se.xiecheng.achitectureclass.service.BusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Business")
@Validated
public class BusinessController extends LogicController<BusinessService, BusinessDao, Business,Long> {
    public BusinessController(@Autowired BusinessService service) {
        super(service);
    }
    @Autowired
    private BusinessService businessService;
    @PostMapping("/creatShopItem")
    public void createShopItem(Business business, Item item) {

        businessService.createShopItem(business, item);
    }
    @PostMapping("/creatShop")
    public void createShop(Shop shop, Business business) {
        businessService.createShop(shop,business);
    }
    @PostMapping("/addItemToShop")
    public void addItemToShop(Long businessId, Long itemId,Long shopId) {
        businessService.addItemToShop(businessId, itemId,shopId);
    }
}
